package com.tmy.sst.service.security;

import com.tmy.sst.utils.MD5Util;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Service;

// @Service("passwordEncoderImpl")
public class PasswordEncoderImpl implements PasswordEncoder {
    @Override
    public String encode(CharSequence rawPassword) {
        return MD5Util.encode((String) rawPassword);
    }

    @Override
    public boolean matches(CharSequence rawPassword, String encodedPassword) {
        String encPassword = MD5Util.encode((String) rawPassword);
        boolean isok =  encodedPassword.equals(MD5Util.encode((String) rawPassword));
        return isok;
    }
}
